﻿using System.IO;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Xml;
using System.ServiceModel.Channels;

namespace dasBlog.Storage
{
    [ServiceContract(Namespace = "http://dasblog.info/2007/08/webstoragenode/")]
    public interface IWebStorageNode
    {
        [OperationContract, WebGet(UriTemplate = "/{scopeid}/{node}/")]
        Message Select(string scopeid, string node);

        [OperationContract, WebGet(UriTemplate = "/{scopeid}/{node}/{id}/{substg}/*")]
        Message Subselect(string scopeid, string node, string id, string substg);

        [OperationContract, WebGet(UriTemplate = "/{scopeid}/{node}/{id}/")]
        Message GetItem(string scopeid, string node, string id);

        [OperationContract, WebInvoke(Method = "DELETE", UriTemplate = "/{scopeid}/{node}/{id}/")]
        void DeleteItem(string scopeid, string node, string id);

        [OperationContract, WebInvoke(Method = "POST", UriTemplate = "/{scopeid}/{node}/")]
        void AddItem(string scopeid, string node, XmlElement item);

        [OperationContract, WebInvoke(Method = "POST", UriTemplate = "/{scopeid}/{node}/{id}/{substg}/*")]
        void AddSubitem(string scopeid, string node, string id, string substg, XmlElement item);

        [OperationContract, WebInvoke(Method = "PUT", UriTemplate = "/{scopeid}/{node}/{id}/")]
        void UpdateItem(string scopeid, string node, string id, XmlElement item);

        [OperationContract, WebGet(UriTemplate = "/bin/{scopeid}/{node}/{streamId}")]
        Stream GetStream(string scopeid, string node, string streamId);

        [OperationContract, WebInvoke(Method = "PUT", UriTemplate = "/bin/{scopeid}/{node}/{streamId}/")]
        string SetStream(string scopeid, string node, string streamId, Stream stream);
    }
}
